/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkgjeudestrategie;

import java.awt.GridLayout;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import pkgjeudestrategie.ressource.Ressource;

/**
 *
 * @author Admin
 */

public class Description extends JComponent{
    
    JLabel img =new JLabel("");
    JTextArea txtDescription;
    JTextArea txtActualEffects;
    JLabel lblNom;
    //categories: recherche, batiment, etc..
    //types: caserne, hopital, recherche en soins, recherche atomique, etc...
    
    public Description( int category,int type){
//        txtDescription.setEnabled(false);
     getInfos(category,type);
           }
    public JComponent[] getComponent(){
        JComponent[] pnl={img, lblNom,txtDescription,txtActualEffects};
        return pnl;
    }
    private void getInfos( int category,int type){
        if(category==1){//batiment
          txtDescription=new JTextArea(Batiment.getDescription(type,0));
          lblNom=new JLabel(Batiment.getDescription(type,1));
          img=new JLabel(new ImageIcon(Batiment.getDescription(type,2)));
          txtActualEffects=new JTextArea(Batiment.getDescription(type,3));
        }
        else if(category==2){//recherche
          txtDescription=new JTextArea(Recherche.getDescription(type,0));
          lblNom=new JLabel(Recherche.getDescription(type,1));
          txtActualEffects=new JTextArea(Recherche.getDescription(type,3));
            
        }
        else if(category==3){//ressource
          txtDescription=new JTextArea(Ressource.getDescription(type,0));
          lblNom=new JLabel(Ressource.getDescription(type,1));
          txtActualEffects=new JTextArea(Ressource.getDescription(type,3));
            
        }
        else if(category==4){//bombardements
            String s="";
            String s2="";
            if(type==0){
                s="Bombardement économique.\nVictimes: ~5000\nCoût: 750$";
                s2="B. régulier";
                img=new JLabel(new ImageIcon("imagespi\\bombardement.png"));
            }if(type==1){
                s="Bombardement efficace.\nMal vu.\nVictimes: ~17000 morts\nCoût: 3000$";
                s2="B.chimique";
                img=new JLabel(new ImageIcon("imagespi\\recChimiqueIc.png"));
            }if(type==2){
                s="Bombardement ultime.\nTrès mal vu.\nVictimes: tout le monde.\nCoût: 5000$";
                s2="B.atomique";
                img=new JLabel(new ImageIcon("imagespi\\recAtomiqueIc.png"));
            }
          txtDescription=new JTextArea(s);
          lblNom=new JLabel(s2);
          txtActualEffects=new JTextArea(Ressource.getDescription(type,3));
            
        }
    }
}
